////////////////////////////////////////////////////
////////////////Checking for Mutes//////////////////
////////////////////////////////////////////////////

mob/Login()
	spawn()src.Mute_Check()
	..()

////////////////////////////////////////////////////
////////////////////Logs////////////////////////////
////////////////////////////////////////////////////
proc/Save_Logs()
	var/savefile/A = new ("Muted Keys.sav")
	A["Muted Keys"]<< Muted_Keys
	var/savefile/B = new ("Muted IPs.sav")
	B["Muted IPs"]<< Muted_IPs
proc/Load_Logs()
	if(fexists("Muted Keys.sav"))
		var/savefile/F = new("Muted Keys.sav")
		F["Muted Keys"]>> Muted_Keys
	if(fexists("Muted IPs.sav"))
		var/savefile/F = new("Muted IPs.sav")
		F["Muted IPs"]>> Muted_IPs

////////////////////////////////////////////////////
///////////////////Variables////////////////////////
////////////////////////////////////////////////////

var/list/Muted_Keys=list()
var/list/Muted_IPs=list()
mob/var/Muted=0
////////////////////////////////////////////////////
//////////////Mute Checking Proc////////////////////
////////////////////////////////////////////////////

mob/proc/Mute_Check()
	if(src.key in Muted_Keys)
		if(src.client.address in Muted_IPs)
			src.Muted=1
			return
		else
			Muted_IPs+=src.client.address
			src.Muted=1
	if(src.client.address in Muted_IPs)
		if(src.key in Muted_Keys)
			src.Muted=1
			return
		else
			Muted_Keys+=src.key
			src.Muted=1
			return

//////////////////////////////////////////////////////
//////////////////////Mute Verb///////////////////////
//////////////////////////////////////////////////////
Admin/verb/Mute()
	set category="Admin"
	var/list/players=list()
	for(var/mob/M in world)
		players+=M
	var/s=input("Who would you like to Mute?")in players+"Cancel"
	for(var/mob/M)
		if(M==s)
			if(!M.Muted)
				M.Muted=1
				Muted_Keys+=M.key
				Muted_IPs+=M.client.address
				world<<"<font color=red><B>[M] has been muted!"
			else
				M.Muted=0
				Muted_Keys-=M.key
				Muted_IPs-=M.client.address
				world<<"<font color=green><B>[M] has been Unmuted!"

////////////////////////////////////////////////////////
///////////////////Saving Logs//////////////////////////
////////////////////////////////////////////////////////
world/Del()
	Save_Logs()
	..()
world/New()
	Load_Logs()
	..()